import React, {useState,useEffect}from 'react';
import './nav.css'
const Index = () => {
    const [opacity,setOpacity]=useState(0);
    const handleScroll=()=>{
        var scrollTop=window.scrollY;
        // console.log(scrollTop);
        var flag=scrollTop/200;
        console.log(flag);
        if(flag>1){
            flag=1
        }
        setOpacity(flag)
    }
    useEffect(()=>{
        window.addEventListener("scroll",handleScroll)
        return ()=>{
            window.removeEventListener("scroll",handleScroll)
        }
    })
    return (
        <div>
           <div className="nav" style={{opacity:opacity}}>nav</div>
        </div>
    );
}

export default Index;
